<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>Document</title>
	<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		function getValue(element){
			//语法：jQuery.ajax([settings])
			$.ajax({
				//请求方式 ("POST" 或 "GET")
				type:"get",
				//向服务器请求的url地址
				url:"getajax",
				//发送到服务器的数据
				//<a href="user/manager?id=1&q=list"></a>
				data:"action=getvalue",
				//预期服务器返回的数据类型
				dataType:'json',
				//异步请求
				async:true,
				//data从后台返回前台的数据被data参数接收
				success:function(data){
					for(var i = 0;i<data.length;i++){
						$(element).append("<option>"+data[i]+"</option>");
					}
				}
			});
		}
	</script>
</head>
<body>
	<div>
		<select id="select1" onfocus="getValue(this)">
			<option value="1">点击取值</option>
		</select>
	</div>
</body>
</html>